<?
ob_start(); 
include("common/header.html");
include("common/left.html");
$out_html=ob_get_contents();
ob_end_clean();
include("class/BillRecord_dt.php");
include("class/OrderRecord.php");
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));

$id=abs($_REQUEST['id']);
$r=array();
$br=new BillRecord($id,$s);

$r=$br->detail();
// print_r($dnames);
// exit;
// print_r($r);
$b_info=$br->info();
$totals=$br->billcount();
$countby=$_REQUEST['countby']=="lid"?"lid":"tid";
$summary=$br->ordercount($countby);
 //print_r($summary);
/*导出EXCEL处理程序--begin-*/
include("ExcelHandle.php");
/*导出EXCEL处理程序--end*/
echo $out_html;
?>
<link type="text/css" rel="stylesheet" href="http://www.16u.com/manage/admin/dt/css/jquery.dataTables_themeroller.css" rel="stylesheet" media="screen" />
<link type="text/css" rel="stylesheet" href="http://www.16u.com/manage/admin/dt/css/themes/redmond/jquery-ui-1.7.2.custom.css" media="screen" />
<link type="text/css" rel="stylesheet" href="css/bill.css" media="screen" />
<script type="text/javascript" language="javascript" src="http://www.16u.com/manage/admin/dt/js/jquery.dataTables.min.js"></script>
<script>
	$(document).ready(function(){
		$('#tableDetail').dataTable({
			"bJQueryUI": true,
			"aaSorting": [[0,'desc']],
			"sPaginationType": "full_numbers"
		 });
	});
</script>
<div class="clay">
		<h3 class="mc_title">
			<span class="mctit_1"><span class="mctit_2">账单汇总</span></span>
		</h3>
		<div class="head">
			<a class="fr excel" href="?id=<?=$_REQUEST['id']?>&countby=<?=$countby?>&act=fsettle2Excel">导出</a>
			<h3>
				<span>账单期间：<strong class="time"><?=$b_info['btime']?></strong> 至 <strong class="time"><?=$b_info['etime']?></strong></span>
			</h3>
			<p><span class="countby">
					<a href="?id=<?=$id?>&countby=lid">按商品汇总</a>
					|
					<a href="?id=<?=$id?>">按票类汇总</a>
				</span>账单统计：订单总数<em class="orange count"> <?=$totals[0]?> </em>单，门票总数<em class="green count"> <?=$totals[1]?> </em>张，总金额<em class="red count"> <?=$totals[2]/100?> </em>元</p>
		</div>
			<table id="tableDetail">
			<thead>
				<tr>
					<th class="name">产品所属</th>
					<th>订单总数</th>
					<th>总人数</th>
					<th>总金额（元）</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?foreach($summary as $lid=>$row){?>
				<tr>
					<td class="name"><?=$row['ltitle']?></td>
					<td><?=$row['order']?></td>
					<td><?=$row['tnum']?></td>
					<td><?=$row['money']/100?></td>
					<td><a target="_blank" href="bill_detail.html?id=<?=$id?>&<?=$countby?>=<?=$lid?>">显示所属订单</a></td>
				</tr>
				<?}?>
			</tbody>
		</table>
</div>
<?include("common/footer.html");?>